<?php
function smarty_modifier_like() {
	$args = func_get_args();
	$html="";
	$type = $args[0];
	$id = $args[1];
	$nbuid = $args[2];
	if ($nbuid) {
		$isPraised = Praise::isPraised($nbuid, $type, $id);
		$bonus = Praise::GetPraiseBonusTimes($nbuid);
	}
	$smarty->assign('isPraised', $isPraised);
	$smarty->assign('bonus', $bonus);

	$smarty->assign('count', Praise::GetCount($type, $id));
	$smarty->assign('praiseLog', Praise::GetPraiseLog($type, $id, 15));



	if(count($args)>=3){
		$kpdo = getkpdo();
		$sql = "select count(*) c from `collect` where uid=? and `type`=? and `typefield`=? and objid=? ";
		$c =null;
		$c = $kpdo->one($sql,array($_SESSION['NB_uid'],$args[0],$args[2],$args[1]));
		if($c){
			$html.="<a class='ui_fav ui_has_fav' id='collect_kannb' data-value=1 href=javascript:albumCollect('".$args[0]."','".$args[1]."','".$args[2]."',$callBack); target=_blank class='ui_fav ui_has_fav'><i class='iconfont'>&#xf01e;</i>取消收藏</a>";
		}else{
			$html.="<a class='ui_fav' id='collect_kannb' data-value=0 href=javascript:albumCollect('".$args[0]."','".$args[1]."','".$args[2]."',$callBack); target=_blank><i class='iconfont'>&#xe616;</i>收藏</a>";
		}

	}else{
		$html.="收藏";
	}
	return $html;
}
